{extend name="pc/admin/layout"/}
{block name="main"}
   <div class="g-1400 g-container" id="pjax-container">
        
<div class="bg-bai b rx3" id="vue-page">
<form id="form-config">
    <div class="t-v t-t">
        <div class="c-sidebar c-sidebar-h pb5 br">
            <div class="c-sidebar-title t-v hui bb">网站基础设置</div>
            <ul class="c-nav click-nav">
                <li><a href="{:url('pc/admin')}" class="t-v" data-pjax>
                    <div><i class="icon icon-form"></i></div>
                    <div>网站信息</div>
                </a></li>
				<li><a href="{:url('pc/admin',['act'=>'set','s'=>'reg'])}" class="t-v" data-pjax>
                    <div><i class="icon icon-form"></i></div>
                    <div>注册奖励</div>
                </a></li>
				<li><a href="{:url('pc/admin',['act'=>'set','s'=>'mail'])}" class="t-v" data-pjax>
                    <div><i class="icon icon-form"></i></div>
                    <div>邮箱提醒</div>
                </a></li>
				<li><a href="{:url('pc/admin',['act'=>'set','s'=>'chat'])}" class="t-v" data-pjax>
                    <div><i class="icon icon-form"></i></div>
                    <div>聊天发言</div>
                </a></li>
				{if condition="config('web_web_id') eq 1"}
				<li class="active"><a href="{:url('pc/admin',['act'=>'set','s'=>'task'])}" class="t-v" data-pjax>
                    <div><i class="icon icon-form"></i></div>
                    <div>任务运行</div>
                </a></li>
				<li><a href="{:url('pc/admin',['act'=>'set','s'=>'cron'])}" class="t-v" data-pjax>
                    <div><i class="icon icon-form"></i></div>
                    <div>任务监控</div>
                </a></li>
				{/if}
				<li><a href="{:url('pc/admin',['act'=>'set','s'=>'plugins'])}" class="t-v" data-pjax>
                    <div><i class="icon icon-form"></i></div>
                    <div>网站插件</div>
                </a></li>
				{if condition="config('web_web_id') eq 1"}
				<li><a href="{:url('pc/admin',['act'=>'set','s'=>'server'])}" class="t-v" data-pjax>
                    <div><i class="icon icon-form"></i></div>
                    <div>服务器设置</div>
                </a></li>
				{/if}
            </ul>
        </div>
<div class="c-content bl">
            <div class="col-6 fl br" style="min-height:420px;">
                <div class="g-title t-v pl4 bb">
                    <div class="col-12 h t-v bold">基本配置</div>
                </div>
				<div class="p5 o-h">
        <div class="pt1 pb3 in-text">
            <dt class="bold bb pr2 lan">监控本地回路</dt>
            <dd><select class="form w h8 bb" name="local_cron" default="{:config('sys_local_cron')}">
                <option value="0">关闭</option>
                <option value="1" {if condition="config('sys_local_cron') eq 1" }selected {/if}>开启</option>
            </select></dd>
        </div>
		<div class="pt1 pb3 in-text">
			<dd class="lv">开启本地回路能使监控运行更迅速。本地回路主要用于解决开启CDN之后访问IP和源站IP不一样而导致无法监控或监控慢的问题。</dd>
        </div>
		<div class="pt1 pb3 in-text">
            <dt class="bold bb pr2 lan">单/多线程运行</dt>
            <dd><select class="form w h8 bb" name="runmodol" default="{:config('sys_runmodol')}">
                <option value="0" {if condition="config('sys_runmodol') eq 0" }selected {/if}>多线程运行</option>
                <option value="1" {if condition="config('sys_runmodol') eq 1" }selected {/if}>强制单线程</option>
            </select></dd>
        </div>
		<div class="pt1 pb3 in-text">
			<dd class="lv">默认多线程模式，运行速度更快，如果多线程模式无法运行任务，可尝试强制单线程，切换到单线程模式后你可能需要加快监控频率。</dd>
        </div>
		<div class="pt1 pb3 in-text">
            <dt class="bold bb pr2 lan">QQ挂机类API设置</dt>
            <dd><select class="form w h8 bb" name="gjapi" default="{:config('sys_gjapi')}">
                <option value="0">本地挂机API</option>
                <option value="9" {if condition="config('sys_gjapi') eq 9" }selected {/if}>自定义挂机API</option>
            </select></dd>
        </div>
		<div class="pt1 pb3 in-text">
			<dd class="lv">如果你的空间实在无法运行QQ挂机类任务可以尝试使用官方API。官方API是需要域名授权的，授权请联系QQ:2687409344</dd>
        </div>
		<div id="frame_set2" style="display:none">
		<div class="pt1 pb3 in-text">
				<dt class="bold bb pr2 lan">自定义挂机API地址</dt>
				<dd><input class="form w h8 bb" type="url" name="gjapiurl" value="{:config('sys_gjapiurl')}"></dd>
		</div>
		<div class="pt1 pb3 in-text">
			<dd class="lv">请填写自定义挂机API必须http://开头/结尾，如果需要获取API源码请联系QQ:2687409344。</dd>
        </div>
		</div>
		</div>
            </div>
            <div class="col-6 fl bl" style="margin-left:-1px;">
                <div class="g-title t-v pl4 bb">
                    <div class="col-12 h t-v bold">运行配置</div>
                </div>
				<div class="p5 o-h">
				<div class="pt1 pb3 in-text">
				<dt class="bold bb pr2 lan">每次/线程执行任务数量</dt>
				<dd><input type="text" class="form w h8 bb" name="interval" value="{:config('sys_interval')}"></dd>
				</div>
				<div class="pt1 pb3 in-text">
					<dd class="lv">每次运行任务数是指在单个系统内，每运行一次监控文件所能够执行的任务数。如果开启多线程后则为每个线程的任务数，建议60。</dd>
				</div>
				<div class="pt1 pb3 in-text">
				<dt class="bold bb pr2 lan">监控文件运行密钥</dt>
				<dd><input type="text" class="form w h8 bb" name="cronkey" value="{:config('sys_cronkey')}"></dd>
				</div>
				<div class="pt1 pb3 in-text">
					<dd class="lv">默认为空。设置密钥后，你需要在所有监控文件后面加上 <u>?cronkey=你的密钥</u>，可防止监控文件被恶意执行</dd>
				</div>
				<div class="pt1 pb3 in-text">
				<dt class="bold bb pr2 lan">每条说说秒赞秒评时间间隔(秒)</dt>
				<dd><input type="text" class="form w h8 bb" name="sleep" value="{:config('sys_sleep')}"></dd>
				</div>
				<div class="pt1 pb3 in-text">
					<dd class="lv">此处可以调整每条说说点赞/评论的时间间隔（单位：秒），用以解决过于频繁导致的获取赞结果失败。0为不间隔。设置过大会导致访问超时。</dd>
				</div>
				<div class="pt1 pb3 in-text">
				<dt class="bold bb pr2 lan">秒赞任务运行时间间隔(秒)</dt>
				<dd><input type="text" class="form w h8 bb" name="sleep2" value="{:config('sys_sleep2')}"></dd>
				</div>
				<div class="pt1 pb3 in-text">
					<dd class="lv">此处可以调整每运行一次秒赞任务的时间间隔（单位：秒），建议50秒，系统限制最小10秒。</dd>
				</div>
		</div>
            </div>
        </div>
</div>
</form>
<div class="c-pagination o-h t-v">
        <div class="c-sidebar"></div>
        <div class="c-content h11 o-h g-btn t-v bt bl">
            <div class="col-12 h t-v f3 hui pl5 pr5 t-c">
			<button class="btn btn-qing btn-md w22 rx1" @click="saveConfig()">保 存 设 置</button></div>
        </div>
    </div>
</div>

    </div>
   {/block}
   {block name='foot'}
		<script>
        new Vue({
            el: '#vue-page',
            methods: {
                saveConfig: function () {
                    app.ajax("{:url('admin_ajax/config')}", $("#form-config").serialize(), function (data) {
                        if (data.code === 0) {
                            x.msg(data.message)
                        } else {
                            x.msg(data.message)
                        }
                    })
                }
            }
        });
		$("select[name='gjapi']").change(function(){
			if($(this).val() == 9){
				$("#frame_set2").css("display","inherit");
			}else{
				$("#frame_set2").css("display","none");
			}
		});
		if ($("select[name='gjapi']").val() == 9){
			$("#frame_set2").css("display","inherit");
		}
    </script>
    {/block}